(#%require sicp-pict)
(define (corner-split painter n)
    (if (= n 0)
        painter
        (let 
            (
                (up (up-split painter (- n 1)))
                (right (right-split painter (-n 1)))
            )
            (let
                (
                    (top-left (beside up up))
                    (bottom-right (below right right))
                    (cornor (corner-split painter (-n 1)))
                )
                (beside 
                    (below painter top-left)
                    (below bottom-right corner)
                )            
            )
        )
    )
)
(define (right-split painter n)
    (if (= n 0)
        painter
        (let 
            (
                (smaller (right-split painter (- n 1)))                
            )
            (beside painter (below smaller smaller))
        )
    )
)
(define (up-split painter n)
    (if (= n 0)
        painter
        (let
            (
                (smaller (up-split painter (- n 1)))
            )
            (below painter (beside smaller smaller))
        )
    )
)

(paint (up-split einstein 4))
(exit)